<template>
	<view class="container">
		<view class="list" v-if="list.length > 0">
			<view class="bill" v-for="item in list" :key="item.id" hover-class="hoverClass">
				<view class="info">
					<view class="left">
						<view class="name">{{ item.name }}</view>
						<view class="name">{{ item.room }}</view>
						<view class="time">应付时间：{{ item.time }}</view>
					</view>
					<view class="right">
						<text class="money">{{ Number(item.money).toFixed(2) }}元</text>
						<uni-icons type="right" size="16" color="#bbb"></uni-icons>
					</view>
				</view>
				<view class="status" v-if="item.status == 1">已逾期</view>
			</view>
		</view>
		<view class="empty" v-else>
			<image class="image" src="@/static/img/empty.png" mode="aspectFit"></image>
			<view class="emptyWord">无待支付账单，请联系管家</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			list: [
				{
					id: 0,
					name: '房租',
					room: '测试101',
					money: 1000.0,
					time: '2023-09-19',
					status: 1
				},
				{
					id: 1,
					name: '房租',
					room: '测试101',
					money: 1000.0,
					time: '2023-10-19',
					status: 0
				},
				{
					id: 2,
					name: '房租',
					room: '测试101',
					money: 1000.0,
					time: '2023-11-19',
					status: 0
				},
				{
					id: 3,
					name: '房租',
					room: '测试101',
					money: 1000.0,
					time: '2023-12-19',
					status: 0
				},
				{
					id: 4,
					name: '房租',
					room: '测试101',
					money: 1000.0,
					time: '2024-01-19',
					status: 0
				},
				{
					id: 5,
					name: '房租',
					room: '测试101',
					money: 1000.0,
					time: '2024-02-19',
					status: 0
				},
				{
					id: 6,
					name: '房租',
					room: '测试101',
					money: 1000.0,
					time: '2024-03-19',
					status: 0
				},
				{
					id: 7,
					name: '房租',
					room: '测试101',
					money: 1000.0,
					time: '2024-04-19',
					status: 0
				}
			]
		};
	},
	onShow() {},
	onPullDownRefresh() {
		setTimeout(() => {
			this.stopPull();
		}, 1000);
	},
	methods: {
		stopPull() {
			uni.stopPullDownRefresh();
		}
	}
};
</script>

<style lang="scss">
.container {
	padding: 20rpx 40rpx;
	.list {
		.bill {
			background: #fff;
			margin-bottom: 20rpx;
			padding: 30rpx;
			box-shadow: $uni-shadow-base;
			position: relative;
			border-radius: 10rpx;
			overflow: hidden;
			.info {
				display: flex;
				justify-content: space-between;
				align-items: center;
				.name {
					font-size: 30rpx;
					font-weight: bold;
					line-height: 1.8;
				}
				.time {
					margin-top: 10rpx;
					font-size: 26rpx;
					color: $uni-secondary-color;
				}
				.right {
					display: flex;
					align-items: center;
					.money {
						color: $uni-warning;
						font-size: 26rpx;
						font-weight: bold;
					}
				}
			}
			.status {
				position: absolute;
				top: 0;
				right: 0;
				font-size: 24rpx;
				color: $uni-error;
				background: $uni-error-light;
				padding:2rpx 10rpx;
			}
		}
	}
}
</style>
